home *** CD-ROM | disk | FTP | other *** search
/ Light ROM 1 / LIGHT-ROM 1 (Amiga Library Services)(1994).iso / ffdisks / d981.lha / CloudsAGA / CloudsGUI.mod < prev    next >
Text File  |  1994-04-04  |  23KB  |  673 lines

  1. MODULE CloudsGUI;
  2.  
  3. (*
  4.  *  Source generated with GadToolsBox V2.0b
  5.  *  which is (c) Copyright 1991-1993 Jaba Development
  6.  *  Oberon-Sourcecode-Generator by Kai Bolay (AMOK)
  7.  *
  8.  *  GUI Designed by : Danny Amor
  9.  *)
  10.  
  11. (* $OvflChk- $RangeChk- $StackChk- $NilChk- $ReturnChk- $CaseChk- $TypeChk- *)
  12.  
  13. IMPORT
  14.  e: Exec, I: Intuition, gt: GadTools, g: Graphics, u: Utility, y: SYSTEM, a: ASL, req: Requests;
  15.  
  16. CONST
  17.   GDSize                            * = 0;
  18.   GDCreate                          * = 1;
  19.   GDAnimate                         * = 2;
  20.   GDSmooth                          * = 3;
  21.   GDSave                            * = 4;
  22.   GDScreen                          * = 5;
  23.   GDPARED                           * = 0;
  24.   GDPAGREEN                         * = 1;
  25.   GDPABLUE                          * = 2;
  26.   GDPAPALETTE                       * = 3;
  27.   GDPAOK                            * = 4;
  28.   GDPALOAD                          * = 5;
  29.   GDPASAVE                          * = 6;
  30.   GDPARESET                         * = 7;
  31.   GDPACANCEL                        * = 8;
  32.  
  33. CONST
  34.   CloudsCNT = 6;
  35.   CloudsLeft = 106;
  36.   CloudsTop = 20;
  37.   CloudsWidth = 106;
  38.   CloudsHeight = 103;
  39.   PaletteCNT = 9;
  40.   PaletteLeft = 10;
  41.   PaletteTop = 15;
  42.   PaletteWidth = 338;
  43.   PaletteHeight = 159;
  44.  
  45. CONST
  46.   GDGadget00                        * = 0;
  47.  
  48. CONST
  49.   InfoReqCNT = 1;
  50.   InfoReqLeft = 112;
  51.   InfoReqTop = 105;
  52.   InfoReqWidth = 358;
  53.   InfoReqHeight = 133;
  54.  
  55. VAR
  56.   Scr*: I.ScreenPtr;
  57.   VisualInfo*: e.APTR;
  58.   CloudsWnd*: I.WindowPtr;
  59.   PaletteWnd*: I.WindowPtr;
  60.   InfoReqWnd*: I.WindowPtr;
  61.   CloudsGList*: I.GadgetPtr;
  62.   CloudsGadgets*: ARRAY CloudsCNT OF I.GadgetPtr;
  63.   PaletteGList*: I.GadgetPtr;
  64.   PaletteGadgets*: ARRAY PaletteCNT OF I.GadgetPtr;
  65.   InfoReqGList*: I.GadgetPtr;
  66.   InfoReqGadgets*: ARRAY InfoReqCNT OF I.GadgetPtr;
  67.   Font*: g.TextAttrPtr;
  68.   Attr*: g.TextAttr;
  69.   FontX, FontY*: INTEGER;
  70.   OffX, OffY: INTEGER;
  71.   Menu*: I.MenuPtr;
  72.  
  73. TYPE
  74.   Size0LArray = ARRAY     5 OF e.STRPTR;
  75. CONST
  76.   Size0Labels = Size0LArray (
  77.     y.ADR ("25"),
  78.     y.ADR ("50"),
  79.     y.ADR ("75"),
  80.     y.ADR ("100"),
  81.     NIL );
  82.  
  83. TYPE
  84.   CloudsGTypesArray = ARRAY CloudsCNT OF INTEGER;
  85. CONST
  86.   CloudsGTypes = CloudsGTypesArray (
  87.     gt.cycleKind,
  88.     gt.buttonKind,
  89.     gt.buttonKind,
  90.     gt.buttonKind,
  91.     gt.buttonKind,
  92.     gt.buttonKind
  93.   );
  94.  
  95. TYPE
  96.   CloudsNGadArray = ARRAY CloudsCNT OF gt.NewGadget;
  97. CONST
  98.   CloudsNGad = CloudsNGadArray (
  99.     43, 2, 59, 15, y.ADR ("Si_ze"), NIL, GDSize, LONGSET {gt.placeTextLeft} ,NIL, NIL,
  100.     3, 19, 99, 15, y.ADR ("_Create"), NIL, GDCreate, LONGSET {gt.placeTextIn} ,NIL, NIL,
  101.     3, 35, 99, 15, y.ADR ("_Palette"), NIL, GDAnimate, LONGSET {gt.placeTextIn} ,NIL, NIL,
  102.     3, 51, 99, 15, y.ADR ("S_mooth"), NIL, GDSmooth, LONGSET {gt.placeTextIn} ,NIL, NIL,
  103.     3, 67, 99, 15, y.ADR ("_Save"), NIL, GDSave, LONGSET {gt.placeTextIn} ,NIL, NIL,
  104.     3, 83, 99, 15, y.ADR ("Sc_reen"), NIL, GDScreen, LONGSET {gt.placeTextIn} ,NIL, NIL
  105.   );
  106.  
  107. TYPE
  108.   CloudsGTagsArray = ARRAY    20 OF u.Tag;
  109. CONST
  110.   CloudsGTags * = CloudsGTagsArray (
  111.     gt.underscore, ORD ('_'), gt.cyLabels, y.ADR (Size0Labels[0]), u.done,
  112.     gt.underscore, ORD ('_'), u.done,
  113.     gt.underscore, ORD ('_'), u.done,
  114.     gt.underscore, ORD ('_'), u.done,
  115.     gt.underscore, ORD ('_'), u.done,
  116.     gt.underscore, ORD ('_'), u.done
  117.   );
  118. TYPE
  119.   PaletteGTypesArray = ARRAY PaletteCNT OF INTEGER;
  120. CONST
  121.   PaletteGTypes = PaletteGTypesArray (
  122.     gt.sliderKind,
  123.     gt.sliderKind,
  124.     gt.sliderKind,
  125.     gt.paletteKind,
  126.     gt.buttonKind,
  127.     gt.buttonKind,
  128.     gt.buttonKind,
  129.     gt.buttonKind,
  130.     gt.buttonKind
  131.   );
  132.  
  133. TYPE
  134.   PaletteNGadArray = ARRAY PaletteCNT OF gt.NewGadget;
  135. CONST
  136.   PaletteNGad = PaletteNGadArray (
  137.     83, 8, 242, 13, y.ADR ("Red:    "), NIL, GDPARED, LONGSET {gt.placeTextLeft,gt.highLabel} ,NIL, NIL,
  138.     83, 25, 242, 13, y.ADR ("Green:  "), NIL, GDPAGREEN, LONGSET {gt.placeTextLeft,gt.highLabel} ,NIL, NIL,
  139.     83, 42, 242, 13, y.ADR ("Blue:   "), NIL, GDPABLUE, LONGSET {gt.placeTextLeft,gt.highLabel} ,NIL, NIL,
  140.     11, 88, 314, 47, y.ADR ("_Palette"), NIL, GDPAPALETTE, LONGSET {gt.placeTextAbove} ,NIL, NIL,
  141.     4, 141, 91, 14, y.ADR ("_OK"), NIL, GDPAOK, LONGSET {gt.placeTextIn} ,NIL, NIL,
  142.     83, 58, 76, 14, y.ADR ("_Load..."), NIL, GDPALOAD, LONGSET {gt.placeTextIn} ,NIL, NIL,
  143.     166, 58, 76, 14, y.ADR ("_Save..."), NIL, GDPASAVE, LONGSET {gt.placeTextIn} ,NIL, NIL,
  144.     249, 58, 76, 14, y.ADR ("_Reset"), NIL, GDPARESET, LONGSET {gt.placeTextIn} ,NIL, NIL,
  145.     243, 142, 91, 14, y.ADR ("_Cancel"), NIL, GDPACANCEL, LONGSET {gt.placeTextIn} ,NIL, NIL
  146.   );
  147.  
  148. TYPE
  149.   PaletteGTagsArray = ARRAY    63 OF u.Tag;
  150. VAR PaletteGTags: PaletteGTagsArray;
  151.  
  152. TYPE
  153.   DriPenArray = ARRAY     1 OF INTEGER;
  154. CONST
  155.   DriPens = DriPenArray (-1);
  156.  
  157. TYPE
  158.   MenuArray = ARRAY     5 OF gt.NewMenu;
  159. CONST
  160.   NewMenu = MenuArray (
  161.     gt.title, y.ADR ("Project"), NIL, {}, y.VAL (LONGSET, 0), NIL,
  162.     gt.item, y.ADR ("About..."), y.ADR ("A"), {}, y.VAL (LONGSET, 0), NIL,
  163.     gt.item, gt.barLabel, NIL, {}, LONGSET {}, NIL,
  164.     gt.item, y.ADR ("Quit..."), y.ADR ("Q"), {}, y.VAL (LONGSET, 0), NIL,
  165.     gt.end, NIL, NIL, {}, LONGSET {}, NIL);
  166.  
  167. VAR
  168.   InfoReqIText: ARRAY 7 OF I.IntuiText;
  169. TYPE
  170.   InfoReqGTypesArray = ARRAY InfoReqCNT OF INTEGER;
  171. CONST
  172.   InfoReqGTypes = InfoReqGTypesArray (
  173.     gt.buttonKind
  174.   );
  175.  
  176. TYPE
  177.   InfoReqNGadArray = ARRAY InfoReqCNT OF gt.NewGadget;
  178. CONST
  179.   InfoReqNGad = InfoReqNGadArray (
  180.     133, 114, 91, 14, y.ADR ("_Ok"), NIL, GDGadget00, LONGSET {gt.placeTextIn} ,NIL, NIL
  181.   );
  182.  
  183. TYPE
  184.   InfoReqGTagsArray = ARRAY     3 OF u.Tag;
  185. CONST
  186.   InfoReqGTags = InfoReqGTagsArray (
  187.     gt.underscore, ORD ('_'), u.done
  188.   );
  189.  
  190. PROCEDURE ComputeX (value: INTEGER): INTEGER;
  191. BEGIN
  192.   RETURN ((FontX * value) + 4 ) DIV 8;
  193. END ComputeX;
  194.  
  195. PROCEDURE ComputeY (value: INTEGER): INTEGER;
  196. BEGIN
  197.   RETURN ((FontY * value)  + 4 ) DIV 8;
  198. END ComputeY;
  199.  
  200. PROCEDURE ComputeFont (width, height: INTEGER; VAR Scr: I.ScreenPtr);
  201. BEGIN
  202.   Font := y. ADR (Attr);
  203.   Font^.name := Scr^.rastPort.font^.message.node.name;
  204.   FontY := Scr^.rastPort.font^.ySize;
  205.   Font^.ySize := FontY;
  206.   FontX := Scr^.rastPort.font^.xSize;
  207.  
  208.   OffX := Scr^.wBorLeft;
  209.   OffY := Scr^.rastPort.txHeight + Scr^.wBorTop + 1;
  210.  
  211.   IF (width # 0) AND (height # 0) AND
  212.      (ComputeX (width) + OffX + Scr^.wBorRight > Scr^.width) OR
  213.      (ComputeY (height) + OffY + Scr^.wBorBottom > Scr^.height) THEN
  214.     Font^.name := y.ADR ("topaz.font");
  215.     Font^.ySize := 8;
  216.     FontY := Font^.ySize;
  217.     FontX := Font^.ySize;
  218.   END;
  219. END ComputeFont;
  220.  
  221. PROCEDURE SetupScreen*(VAR depth,resx,resy: LONGINT): INTEGER;
  222.  
  223. VAR Req                : UNTRACED POINTER TO a.ScreenModeRequester;
  224.     DisplayID          : LONGINT;
  225.     Ok                 : BOOLEAN;
  226.  
  227. BEGIN
  228.   IF a.asl.version>37 THEN
  229.     IF a.asl#NIL THEN
  230.       Req := a.AllocAslRequestTags(a.screenModeRequest,
  231.                                    a.doOverscanType,1,
  232.                                    a.doAutoScroll,1,
  233.                                    a.doHeight,1,
  234.                                    a.doWidth,1,
  235.                                    a.doDepth,1,
  236.                                    a.initialDisplayID,g.euro72ProductKey,
  237.                                    a.initialDisplayWidth,656,
  238.                                    a.initialDisplayHeight,414,
  239.                                    a.initialDisplayDepth,depth,
  240.                                    a.smMinDepth,5,
  241.                                    a.smMaxDepth,7,
  242.                                    u.done);
  243.       IF Req#NIL THEN
  244.         Ok:=a.AslRequest(Req,NIL);
  245.         IF Ok THEN
  246.           DisplayID := Req^.displayID;
  247.           resx      := Req^.displayWidth;
  248.           resy      := Req^.displayHeight;
  249.           depth     := Req^.displayDepth;
  250.  
  251.           Scr := I.OpenScreenTagsA (NIL, I.saLeft,          0,
  252.                                          I.saTop,           0,
  253.                                          I.saWidth,         resx,
  254.                                          I.saHeight,        resy,
  255.                                          I.saDepth,         depth,
  256.                                          I.saType,          LONGSET{0..3},
  257.                                          I.saDisplayID,     DisplayID,
  258.                                          I.saAutoScroll,    I.LTRUE,
  259.                                          I.saOverscan,      I.oScanText,
  260.                                          I.saPens,          y.ADR (DriPens[0]),
  261.                                          I.saTitle,         y.ADR ("CloudsAGA 1.05 © Danny Amor in 1994"),
  262.                                     u.done);
  263.           IF Scr = NIL THEN RETURN 1 END;
  264.  
  265.           ComputeFont (0, 0, Scr);
  266.  
  267.           VisualInfo := gt.GetVisualInfo (Scr, u.done);
  268.           IF VisualInfo = NIL THEN RETURN 2 END;
  269.         ELSE RETURN 5 END;
  270.       END;
  271.     END;
  272.   ELSE
  273.     IF g.base.libNode.version>36 THEN
  274.       Ok:=req.Request("Clouds Request:","You only have Workbench 2.0!\nYou can only choose between high\nand low resolution!","High","Low");
  275.       depth:=5;
  276.       resx:=320;
  277.       resy:=256;
  278.       DisplayID:=g.loresKey+g.palMonitorID;
  279.       IF Ok THEN resy:=512; DisplayID:=g.loresLaceKey+g.palMonitorID; END;
  280.       Scr := I.OpenScreenTagsA (NIL, I.saLeft,          0,
  281.                                      I.saTop,           0,
  282.                                      I.saWidth,         resx,
  283.                                      I.saHeight,        resy,
  284.                                      I.saDepth,         depth,
  285.                                      I.saType,          LONGSET{0..3},
  286.                                      I.saDisplayID,     DisplayID,
  287.                                      I.saAutoScroll,    I.LTRUE,
  288.                                      I.saPens,          y.ADR (DriPens[0]),
  289.                                      I.saTitle,         y.ADR ("CloudsAGA 1.05 © Danny Amor in 1994"),
  290.                                      u.done);
  291.           IF Scr = NIL THEN RETURN 1 END;
  292.  
  293.           ComputeFont (0, 0, Scr);
  294.  
  295.           VisualInfo := gt.GetVisualInfo (Scr, u.done);
  296.           IF VisualInfo = NIL THEN RETURN 2 END;
  297.     ELSE
  298.       req.Fail("Sorry, you need Amiga-OS 2.0 or higher!");
  299.     END;
  300.   END;
  301.   RETURN 0;
  302. END SetupScreen;
  303.  
  304. PROCEDURE CloseDownScreen* (VAR scr : I.ScreenPtr);
  305. BEGIN
  306.   IF VisualInfo # NIL THEN
  307.     gt.FreeVisualInfo (VisualInfo);
  308.     VisualInfo := NIL;
  309.   END;
  310.   IF Scr # NIL THEN
  311.     IF I.CloseScreen (Scr) THEN END;
  312.     Scr := NIL;
  313.   END;
  314. END CloseDownScreen;
  315.  
  316. PROCEDURE OpenCloudsWindow* (VAR CloudsWnd: I.WindowPtr; VAR Scr: I.ScreenPtr): INTEGER;
  317.  
  318.  
  319. VAR
  320.   ng: gt.NewGadget;
  321.   gad: I.GadgetPtr;
  322.   help: u.TagListPtr;
  323.   lc, tc, lvc, offx, offy: INTEGER;
  324.   wleft, wtop: INTEGER;
  325.  
  326. BEGIN
  327.   wleft := CloudsLeft; wtop := CloudsTop;
  328.  
  329.   ComputeFont (CloudsWidth, CloudsHeight,Scr);
  330.  
  331.   wleft := Scr^.width - ComputeX(CloudsWidth);
  332.   wtop := OffY;
  333.  
  334.   Menu := gt.CreateMenus (NewMenu, gt.mnNewLookMenus, 1,u.done);
  335.   IF Menu = NIL THEN RETURN 3 END;
  336.  
  337.   IF NOT gt.LayoutMenus (Menu, VisualInfo, gt.mnTextAttr, Font, u.done) THEN RETURN 4 END;
  338.  
  339.   gad := gt.CreateContext (CloudsGList);
  340.   IF gad = NIL THEN RETURN 1 END;
  341.  
  342.   lc := 0; tc := 0; lvc := 0;
  343.  
  344.   WHILE lc < CloudsCNT DO
  345.     ng := CloudsNGad[lc];
  346.     ng.visualInfo := VisualInfo;
  347.     ng.textAttr   := Font;
  348.     ng.leftEdge   := OffX + ComputeX (ng.leftEdge);
  349.     ng.topEdge    := OffY + ComputeY (ng.topEdge);
  350.     ng.width      := ComputeX (ng.width);
  351.     ng.height     := ComputeY (ng.height);
  352.  
  353.     help := u.CloneTagItems (y.VAL (u.TagListPtr, y.ADR (CloudsGTags[tc])));
  354.     IF help = NIL THEN RETURN 8 END;
  355.     gad := gt.CreateGadgetA (CloudsGTypes[lc], gad, ng, help^ );
  356.     IF gad = NIL THEN RETURN 2 END;
  357.     u.FreeTagItems (help);
  358.     CloudsGadgets[lc] := gad;
  359.  
  360.     WHILE CloudsGTags[tc] # u.done DO INC (tc, 2) END;
  361.     INC (tc);
  362.  
  363.     lc:=lc+1; (* INC (lc); *)
  364.   END; (* WHILE *)
  365.  
  366.   CloudsWnd := I.OpenWindowTagsA ( NIL,
  367.                     I.waLeft,          wleft,
  368.                     I.waTop,           wtop,
  369.                     I.waWidth,         ComputeX(CloudsWidth) + OffX + Scr^.wBorRight,
  370.                     I.waHeight,        ComputeY(CloudsHeight) + OffY + Scr^.wBorBottom,
  371.                     I.waIDCMP,         gt.cycleIDCMP+gt.buttonIDCMP+LONGSET {I.closeWindow,I.refreshWindow,I.vanillaKey,I.menuPick},
  372.                     I.waFlags,         LONGSET {I.windowDrag,I.windowDepth,I.windowClose,I.activate,I.newLookMenus},
  373.                     I.waGadgets,       CloudsGList,
  374.                     I.waTitle,         y.ADR ("Clouds"),
  375.                     I.waScreenTitle,   y.ADR ("CloudsAGA 1.05 © Danny Amor in 1994"),
  376.                     I.waCustomScreen,  Scr,
  377.                     u.done);
  378.  
  379.   IF CloudsWnd = NIL THEN RETURN 20 END;
  380.  
  381.   IF NOT I.SetMenuStrip (CloudsWnd, Menu^) THEN RETURN 5 END;
  382.   gt.RefreshWindow (CloudsWnd, NIL);
  383.  
  384.   RETURN 0;
  385.  
  386. END OpenCloudsWindow;
  387.  
  388. PROCEDURE CloseCloudsWindow* (VAR CloudsWnd: I.WindowPtr);
  389. BEGIN
  390.   IF Menu # NIL THEN
  391.     IF CloudsWnd # NIL THEN
  392.       I.ClearMenuStrip (CloudsWnd);
  393.     END;
  394.     gt.FreeMenus(Menu);
  395.     Menu := NIL;
  396.   END;
  397.   IF CloudsWnd # NIL THEN
  398.     I.CloseWindow (CloudsWnd);
  399.     CloudsWnd := NIL;
  400.   END;
  401.   IF CloudsGList # NIL THEN
  402.     gt.FreeGadgets (CloudsGList);
  403.     CloudsGList := NIL;
  404.   END;
  405. END CloseCloudsWindow;
  406.  
  407.  
  408. PROCEDURE PaletteRender*;
  409. BEGIN
  410.   gt.DrawBevelBox(PaletteWnd^.rPort, OffX + ComputeX (4),
  411.                   OffY + ComputeY (4),
  412.                   ComputeX (329),
  413.                   ComputeY (134),
  414.                   gt.visualInfo, VisualInfo, gt.bbRecessed, I.LTRUE, u.done);
  415. END PaletteRender;
  416.  
  417. PROCEDURE OpenPaletteWindow* (depth: LONGINT): INTEGER;
  418.  
  419. VAR
  420.   ng: gt.NewGadget;
  421.   gad: I.GadgetPtr;
  422.   help: u.TagListPtr;
  423.   lc, tc, lvc, offx, offy: INTEGER;
  424.   wleft, wtop, ww, wh: INTEGER;
  425. BEGIN
  426.  PaletteGTags := PaletteGTagsArray (
  427.     gt.slMax, 255, gt.slMaxLevelLen, 4, gt.slLevelFormat, y.ADR ("%2ld"), I.pgaFreedom, I.lorientHoriz, I.gaRelVerify, I.LTRUE, u.done,
  428.     gt.slMax, 255, gt.slMaxLevelLen, 4, gt.slLevelFormat, y.ADR ("%2ld"), I.pgaFreedom, I.lorientHoriz, I.gaRelVerify, I.LTRUE, u.done,
  429.     gt.slMax, 255, gt.slMaxLevelLen, 4, gt.slLevelFormat, y.ADR ("%2ld"), I.pgaFreedom, I.lorientHoriz, I.gaRelVerify, I.LTRUE, u.done,
  430.     gt.paDepth, 5, gt.paIndicatorWidth, 50, gt.paColor, 3, gt.paColorOffset, 0, gt.underscore, ORD ('_'), u.done,
  431.     gt.underscore, ORD ('_'), u.done,
  432.     gt.underscore, ORD ('_'), I.gaDisabled, I.LTRUE, u.done,
  433.     gt.underscore, ORD ('_'), I.gaDisabled, I.LTRUE, u.done,
  434.     gt.underscore, ORD ('_'), u.done,
  435.     gt.underscore, ORD ('_'), u.done
  436.   );
  437.   IF depth#5 THEN PaletteGTags[34]:=depth; END;
  438.   IF g.base.libNode.version<39 THEN
  439.     PaletteGTags[1] :=15;
  440.     PaletteGTags[12]:=15;
  441.     PaletteGTags[23]:=15;
  442.   END;
  443.  
  444.   wleft := PaletteLeft; wtop := PaletteTop;
  445.  
  446.   ComputeFont (PaletteWidth, PaletteHeight, Scr);
  447.  
  448.   ww := ComputeX (PaletteWidth);
  449.   wh := ComputeY (PaletteHeight);
  450.  
  451.   IF wleft + ww + OffX + Scr^.wBorRight > Scr^.width THEN
  452.     wleft := Scr^.width - ww;
  453.   END;
  454.   IF wtop + wh + OffY + Scr^.wBorBottom > Scr^.height THEN
  455.     wtop := Scr^.height - wh;
  456.   END;
  457.   gad := gt.CreateContext (PaletteGList);
  458.   IF gad = NIL THEN RETURN 1 END;
  459.  
  460.   lc := 0; tc := 0; lvc := 0;
  461.   WHILE lc < PaletteCNT DO
  462.     ng := PaletteNGad[lc];
  463.     ng.visualInfo := VisualInfo;
  464.     ng.textAttr   := Font;
  465.     ng.leftEdge   := OffX + ComputeX (ng.leftEdge);
  466.     ng.topEdge    := OffY + ComputeY (ng.topEdge);
  467.     ng.width      := ComputeX (ng.width);
  468.     ng.height     := ComputeY (ng.height);
  469.  
  470.     help := u.CloneTagItems (y.VAL (u.TagListPtr, y.ADR (PaletteGTags[tc])));
  471.     IF help = NIL THEN RETURN 8 END;
  472.     gad := gt.CreateGadgetA (PaletteGTypes[lc], gad, ng, help^ );
  473.     u.FreeTagItems (help);
  474.     IF gad = NIL THEN RETURN 2 END;
  475.     PaletteGadgets[lc] := gad;
  476.  
  477.     WHILE PaletteGTags[tc] # u.done DO INC (tc, 2) END;
  478.     INC (tc);
  479.  
  480.     INC (lc);
  481.   END; (* WHILE *)
  482.   PaletteWnd := I.OpenWindowTagsA ( NIL,
  483.                     I.waLeft,          wleft,
  484.                     I.waTop,           wtop,
  485.                     I.waWidth,         ww + OffX + Scr^.wBorRight,
  486.                     I.waHeight,        wh + OffY + Scr^.wBorBottom,
  487.                     I.waIDCMP,         gt.sliderIDCMP+gt.paletteIDCMP+gt.buttonIDCMP+LONGSET {I.vanillaKey,I.refreshWindow},
  488.                     I.waFlags,         LONGSET {I.windowDrag,I.windowDepth,I.activate,I.rmbTrap},
  489.                     I.waGadgets,       PaletteGList,
  490.                     I.waTitle,         y.ADR ("Edit Screen Palette"),
  491.                     I.waCustomScreen,  Scr,
  492.                     I.waAutoAdjust,    I.LTRUE,
  493.                     u.done);
  494.   IF PaletteWnd = NIL THEN RETURN 20 END;
  495.  
  496.   gt.RefreshWindow (PaletteWnd, NIL);
  497.  
  498.   PaletteRender;
  499.  
  500.   RETURN 0;
  501. END OpenPaletteWindow;
  502.  
  503. PROCEDURE ClosePaletteWindow*;
  504. BEGIN
  505.   IF PaletteWnd # NIL THEN
  506.     I.CloseWindow (PaletteWnd);
  507.     PaletteWnd := NIL;
  508.   END;
  509.   IF PaletteGList # NIL THEN
  510.     gt.FreeGadgets (PaletteGList);
  511.     PaletteGList := NIL;
  512.   END;
  513. END ClosePaletteWindow;
  514.  
  515. PROCEDURE InfoReqRender*;
  516. BEGIN
  517.   InfoReqIText[0].iText     := y.ADR ("Clouds 1.05");
  518.   InfoReqIText[0].iTextFont := Font;
  519.   InfoReqIText[0].frontPen  := 2;
  520.   InfoReqIText[0].backPen   := 0;
  521.   InfoReqIText[0].drawMode  := g.jam1+SHORTSET {};
  522.   InfoReqIText[0].leftEdge  := OffX + ComputeX (178) - (I.IntuiTextLength (InfoReqIText[0]) DIV 2);
  523.   InfoReqIText[0].topEdge   := OffY + ComputeY (10) - (Font^.ySize DIV 2);
  524.   InfoReqIText[0].nextText  := y.ADR (InfoReqIText[1]);
  525.  
  526.   InfoReqIText[1].iText     := y.ADR ("written by Danny Amor in 1994");
  527.   InfoReqIText[1].iTextFont := Font;
  528.   InfoReqIText[1].frontPen  := 1;
  529.   InfoReqIText[1].backPen   := 0;
  530.   InfoReqIText[1].drawMode  := g.jam1+SHORTSET {};
  531.   InfoReqIText[1].leftEdge  := OffX + ComputeX (178) - (I.IntuiTextLength (InfoReqIText[1]) DIV 2);
  532.   InfoReqIText[1].topEdge   := OffY + ComputeY (22) - (Font^.ySize DIV 2);
  533.   InfoReqIText[1].nextText  := y.ADR (InfoReqIText[2]);
  534.  
  535.   InfoReqIText[2].iText     := y.ADR ("Danny Amor");
  536.   InfoReqIText[2].iTextFont := Font;
  537.   InfoReqIText[2].frontPen  := 1;
  538.   InfoReqIText[2].backPen   := 0;
  539.   InfoReqIText[2].drawMode  := g.jam1+SHORTSET {};
  540.   InfoReqIText[2].leftEdge  := OffX + ComputeX (181) - (I.IntuiTextLength (InfoReqIText[2]) DIV 2);
  541.   InfoReqIText[2].topEdge   := OffY + ComputeY (49) - (Font^.ySize DIV 2);
  542.   InfoReqIText[2].nextText  := y.ADR (InfoReqIText[3]);
  543.  
  544.   InfoReqIText[3].iText     := y.ADR ("Ludwigstr. 124");
  545.   InfoReqIText[3].iTextFont := Font;
  546.   InfoReqIText[3].frontPen  := 1;
  547.   InfoReqIText[3].backPen   := 0;
  548.   InfoReqIText[3].drawMode  := g.jam1+SHORTSET {};
  549.   InfoReqIText[3].leftEdge  := OffX + ComputeX (182) - (I.IntuiTextLength (InfoReqIText[3]) DIV 2);
  550.   InfoReqIText[3].topEdge   := OffY + ComputeY (59) - (Font^.ySize DIV 2);
  551.   InfoReqIText[3].nextText  := y.ADR (InfoReqIText[4]);
  552.  
  553.   InfoReqIText[4].iText     := y.ADR ("70197 Stuttgart");
  554.   InfoReqIText[4].iTextFont := Font;
  555.   InfoReqIText[4].frontPen  := 1;
  556.   InfoReqIText[4].backPen   := 0;
  557.   InfoReqIText[4].drawMode  := g.jam1+SHORTSET {};
  558.   InfoReqIText[4].leftEdge  := OffX + ComputeX (182) - (I.IntuiTextLength (InfoReqIText[4]) DIV 2);
  559.   InfoReqIText[4].topEdge   := OffY + ComputeY (69) - (Font^.ySize DIV 2);
  560.   InfoReqIText[4].nextText  := y.ADR (InfoReqIText[5]);
  561.  
  562.   InfoReqIText[5].iText     := y.ADR ("Germany");
  563.   InfoReqIText[5].iTextFont := Font;
  564.   InfoReqIText[5].frontPen  := 1;
  565.   InfoReqIText[5].backPen   := 0;
  566.   InfoReqIText[5].drawMode  := g.jam1+SHORTSET {};
  567.   InfoReqIText[5].leftEdge  := OffX + ComputeX (180) - (I.IntuiTextLength (InfoReqIText[5]) DIV 2);
  568.   InfoReqIText[5].topEdge   := OffY + ComputeY (79) - (Font^.ySize DIV 2);
  569.   InfoReqIText[5].nextText  := y.ADR (InfoReqIText[6]);
  570.  
  571.   InfoReqIText[6].iText     := y.ADR ("Have you already smiled today?");
  572.   InfoReqIText[6].iTextFont := Font;
  573.   InfoReqIText[6].frontPen  := 2;
  574.   InfoReqIText[6].backPen   := 0;
  575.   InfoReqIText[6].drawMode  := g.jam1+SHORTSET {};
  576.   InfoReqIText[6].leftEdge  := OffX + ComputeX (188) - (I.IntuiTextLength (InfoReqIText[6]) DIV 2);
  577.   InfoReqIText[6].topEdge   := OffY + ComputeY (105) - (Font^.ySize DIV 2);
  578.   InfoReqIText[6].nextText  := NIL;
  579.  
  580.   I.PrintIText (InfoReqWnd^.rPort, InfoReqIText[0], 0, 0);
  581.   gt.DrawBevelBox(InfoReqWnd^.rPort, OffX + ComputeX (244),
  582.                   OffY + ComputeY (35),
  583.                   ComputeX (105),
  584.                   ComputeY (61),
  585.                   gt.visualInfo, VisualInfo, gt.bbRecessed, I.LTRUE, u.done);
  586.   gt.DrawBevelBox(InfoReqWnd^.rPort, OffX + ComputeX (12),
  587.                   OffY + ComputeY (34),
  588.                   ComputeX (105),
  589.                   ComputeY (61),
  590.                   gt.visualInfo, VisualInfo, gt.bbRecessed, I.LTRUE, u.done);
  591. END InfoReqRender;
  592.  
  593. PROCEDURE OpenInfoReqWindow* (): INTEGER;
  594. VAR
  595.   ng: gt.NewGadget;
  596.   gad: I.GadgetPtr;
  597.   help: u.TagListPtr;
  598.   lc, tc, lvc, offx, offy: INTEGER;
  599.   wleft, wtop, ww, wh: INTEGER;
  600. BEGIN
  601.   wleft := InfoReqLeft; wtop := InfoReqTop;
  602.  
  603.   ComputeFont (InfoReqWidth, InfoReqHeight, Scr);
  604.  
  605.   ww := ComputeX (InfoReqWidth);
  606.   wh := ComputeY (InfoReqHeight);
  607.  
  608.   IF wleft + ww + OffX + Scr^.wBorRight > Scr^.width THEN
  609.     wleft := Scr^.width - ww;
  610.   END;
  611.   IF wtop + wh + OffY + Scr^.wBorBottom > Scr^.height THEN
  612.     wtop := Scr^.height - wh;
  613.   END;
  614.   gad := gt.CreateContext (InfoReqGList);
  615.   IF gad = NIL THEN RETURN 1 END;
  616.  
  617.   lc := 0; tc := 0; lvc := 0;
  618.   WHILE lc < InfoReqCNT DO
  619.     ng := InfoReqNGad[lc];
  620.     ng.visualInfo := VisualInfo;
  621.     ng.textAttr   := Font;
  622.     ng.leftEdge   := OffX + ComputeX (ng.leftEdge);
  623.     ng.topEdge    := OffY + ComputeY (ng.topEdge);
  624.     ng.width      := ComputeX (ng.width);
  625.     ng.height     := ComputeY (ng.height);
  626.  
  627.     help := u.CloneTagItems (y.VAL (u.TagListPtr, y.ADR (InfoReqGTags[tc])));
  628.     IF help = NIL THEN RETURN 8 END;
  629.     gad := gt.CreateGadgetA (InfoReqGTypes[lc], gad, ng, help^ );
  630.     u.FreeTagItems (help);
  631.     IF gad = NIL THEN RETURN 2 END;
  632.     InfoReqGadgets[lc] := gad;
  633.  
  634.     WHILE InfoReqGTags[tc] # u.done DO INC (tc, 2) END;
  635.     INC (tc);
  636.  
  637.     INC (lc);
  638.   END; (* WHILE *)
  639.   InfoReqWnd := I.OpenWindowTagsA ( NIL,
  640.                     I.waLeft,          wleft,
  641.                     I.waTop,           wtop,
  642.                     I.waWidth,         ww + OffX + Scr^.wBorRight,
  643.                     I.waHeight,        wh + OffY + Scr^.wBorBottom,
  644.                     I.waIDCMP,         gt.buttonIDCMP+LONGSET {I.vanillaKey,I.refreshWindow},
  645.                     I.waFlags,         LONGSET {I.windowDrag,I.windowDepth,I.activate},
  646.                     I.waGadgets,       InfoReqGList,
  647.                     I.waTitle,         y.ADR ("CloudsAGA Requester"),
  648.                     I.waScreenTitle,   y.ADR ("CloudsAGA 1.05 © Danny Amor in 1994"),
  649.                     I.waPubScreen,     Scr,
  650.                     u.done);
  651.   IF InfoReqWnd = NIL THEN RETURN 20 END;
  652.  
  653.   gt.RefreshWindow (InfoReqWnd, NIL);
  654.  
  655.   InfoReqRender;
  656.  
  657.   RETURN 0;
  658. END OpenInfoReqWindow;
  659.  
  660. PROCEDURE CloseInfoReqWindow*;
  661. BEGIN
  662.   IF InfoReqWnd # NIL THEN
  663.     I.CloseWindow (InfoReqWnd);
  664.     InfoReqWnd := NIL;
  665.   END;
  666.   IF InfoReqGList # NIL THEN
  667.     gt.FreeGadgets (InfoReqGList);
  668.     InfoReqGList := NIL;
  669.   END;
  670. END CloseInfoReqWindow;
  671.  
  672. END CloudsGUI.
  673.